package com.fuqi.android.zhongcai.business.shuig.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.Checkable;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.fuqi.android.zhongcai.R;

/**
 * Created by Bruce on 2016/10/25.
 */
public class ChouchaView extends LinearLayout implements Checkable {
    private CheckBox mCheckBox;
    private TextView mTvAddress;
    private TextView mTvOrigin;
    private TextView mTvStatus;
    public LinearLayout mLyt;

    public ChouchaView(Context context) {
        this(context, null);
    }

    public ChouchaView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.adapter_dai_choucha, this, true);
        mCheckBox = (CheckBox) v.findViewById(R.id.iv_choose);
        mTvAddress = (TextView) v.findViewById(R.id.tv_install_address);
        mTvOrigin = (TextView) v.findViewById(R.id.tv_order_origin);
        mTvStatus = (TextView) v.findViewById(R.id.tv_order_status);
        mLyt = (LinearLayout) v.findViewById(R.id.lyt_item);

    }

    public void setCheck(boolean show) {
        if(show) mCheckBox.setVisibility(VISIBLE);
        else mCheckBox.setVisibility(GONE);
    }

    public void setAddress(String address) {
        mTvAddress.setText(address);
    }
    public void setOrigin(String origin) {
        mTvOrigin.setText(origin);
    }
    public void setStatus(String status) {
        mTvStatus.setText(status);
    }

    @Override
    public boolean isChecked() {
        return mCheckBox.isChecked();
    }

    @Override
    public void setChecked(boolean checked) {
        mCheckBox.setChecked(checked);
    }

    @Override
    public void toggle() {
        mCheckBox.toggle();
    }


}
